package com.keio.common.protocol;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.Map;

/**
 * @author KEIO  on 2022/1/14.
 * @version 1.0
 */
@Getter
@Setter
public class ProxyMessage {

    //消息类型
    private int type;
    //元数据
    private Map<String,Object> metaData;
    //消息内容
    private byte[] data;

    //注册
    public static final int TYPE_REGISTER = 1;
    //授权
    public static final int TYPE_AUTH = 2;
    //建立连接
    public static final int TYPE_CONNECTED = 3;
    //断开连接
    public static final int TYPE_DISCONNECTED = 4;
    //心跳
    public static final int TYPE_KEEPALIVE = 5;
    //数据传输
    public static final int TYPE_DATA = 6;

    public ProxyMessage() {

    }

    public ProxyMessage(int type) {
        this.type = type;
    }



    @Override
    public String toString() {
        return "ProxyMessage{" +
                "type=" + type +
                ", metaData=" + metaData +
                ", data=" + Arrays.toString(data) +
                '}';
    }
}
